package com.imCode.web.model;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by GO FOR IT on 2020/4/18.
 */
public class readTxt {
    public static void main(String[] args) throws IOException {

    }

    public List<student> getStu() throws IOException {
        BufferedReader bufferedReader = null;
        List<student> list = new ArrayList<>();
        student stu = new student();
        try {
            bufferedReader = new BufferedReader(new FileReader("src//odinary.txt"));
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                String[] split = line.split("\\s+");
                stu.setID(split[0]);
                stu.setName(split[1]);
                stu.setCh(split[2]);
                stu.setMa(split[3]);
                stu.setEn(split[4]);
                list.add(stu);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } finally {
            if (bufferedReader != null)
                try {
                    bufferedReader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }

        }
        return list;
    }
}
